//
//  LHBaseNavController.swift
//  LH-Swift-WeiBo
//
//  Created by liuhao on 16/9/22.
//  Copyright © 2016年 liuhao. All rights reserved.
//

import UIKit

class LHBaseNavController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

       //自定义的navigationcontroller
        //实现自定义的左右Button
        
        
    
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

//重写push方法
    
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        
        
        let count = childViewControllers.count
        
        if count > 0{
        
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", target: self, action: #selector(back))
        
            //当进入子界面是隐藏tabBar
            viewController.hidesBottomBarWhenPushed = true
        }
        
        
        
        //一旦空实现这个方法 导航视图控制器无法设置根视图控制器
        //所以要调用父类的push方法
        
        super.pushViewController(viewController, animated: animated)
        print(">>>>>>>>>>⚔⚔⚔⚔我在这里⚔⚔⚔⚔<<<<<<<<<<<<")
        print("我推推推")
        print(">>>>>>>>>>⚔⚔⚔⚔我在这里⚔⚔⚔⚔<<<<<<<<<<<<")
        
        
    }
    
    
   @objc private func back(){
    
        self.popViewController(animated: true)
        
    
    }

}
